package com.chen.demofeigncaller.fallback;

import com.chen.common.dto.ResponseResult;
import com.chen.demofeigncaller.service.TestFeignCallerService;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class ServiceFallbackFactory  implements FallbackFactory<TestFeignCallerService> {
    @Override
    public TestFeignCallerService create(Throwable cause) {
        return new TestFeignCallerService(){
            @Override
            public ResponseResult getTestData() {
                return ResponseResult.fail("熔断，数据失败");
            }
        };
    }
}
